To do

  1. Create a separate virtual disk for the data, and explain how to mount it on the virtual machine.

  2. Understand when and why the file /etc/bash_completion.d/grub appears in the folder /etc/bash_completion.d/. This config file creates warnings (see https://askubuntu.com/questions/778439/have-command-not-found), and I don’t need it since grub is not installed.

  3. Share folder on host computer. Answer mail from Fernando Hayashi Sant Anna about folder sharing not working because cannot install the virtualbox guest additions package.


Requirements

Downloads

Before starting the installation process, we recommend to download the following files

Virtualbox: https://www.virtualbox.org/wiki/Downloads

Ubuntu Desktop: current Ubuntu release is 24.04, but the installation procedure works on earlier versions (maybe some slight modifications)

Installation of the virtual machine

Creating a new virtual machine

  1. Open VirtualBox

  2. In the Machine menu, select the New function.

  3. Parameters

  • Name and Operating System (replace YYYY-MM by the curent year and month)

    • Name: rsat-vb-YYYY-MM
    • Type: Linux
    • Select the Ubuntu installation disk image (file with .iso extension)

    Uncheck the option “Proceed with unattended installation”

  • Memory size: 2048 Mb (this can be modified afterwards).

  • Processors: select it based on the number of cores of your computer and the inteded use of the VM.

  • Virtual Hard Disk: activate Create a virtual hard drive now.

  • Disk Size: 25Gb

At this stage, the VM has been created and needs to be configured before installing the operating system.


General configuration of the network for your VirtualBox program

Before configuring the virtual machine, we need to tell VirtualBox how it will enable your local virtual machines to interact with their host (the operating system of the machine on which the VM is running).

  1. In the File menu, select Tools > Network

  2. Select Host-only Networks manager tab

    • Click on the Create button (“+” icon).

    • This creates a network named Hostnetwork

    • Select this network, click on the Properties button (toothed wheel icon), and check that the options correspond to this:

    • Adapter tab

      • Name: Homenetwork
      • Mask: 255.255.255.0
      • Lower bound: 192.168.56.1
      • Upper bound: 192.168.56.199

Network configuration of the virtual machine

  • In the VirtualBox main window, select the newly created virtual machine.
  • Click on the Settings button.
  • In the VM settings, select tne Network tab.

VirtualBox enables you to specify several adapters, each corresponding to one separate network acces (e.g. using an ethernet card + wi-fi connection). Note that you will have the possibility to modify the network settings later.

VirtualBox offers alternative ways to configure network communications between the virtual machine, the host machine, and the external network. To get more information about network settings:

We present here one possible way to configure your Virtual machine, but this should be adapted to the particular security/flexibility requirements of the network where the maching has to run.

NAT network adapter

By default, we open a network adaptor of type NAT. This allows to establish connections - from your VM (browser, ssh) to the world outside the host machine (your computer) - from your computer to the VM

  • click on the tab Adapter 2,

  • check Enable Network Adapter

  • Attached to: NAT

  • In the topleft corner of the Settings window, click “Expert” to display the advanced configuration options for your NAT.

Port forwarding for the ssh connection (terminal)

In the NAT “expert”configuration panel, click the Port forwarding button, and enter the following parameters

  • Name: ssh
  • Protocol: TCP
  • Host port: 2222
  • Guest port: 22

Leave the other fields blank.

This will enable you to establish ssh connection from your host computer to the VM via the port 2222.

Port forwarding for the web browser (Apache)

To access the web server running inside the virtual machine from your host computer, we also need to forward the HTTP port.

In the Port forwarding window, add a second rule with the following parameters:

  • Name: http
  • Protocol: TCP
  • Host port: 8080
  • Guest port: 80

Leave the other fields blank.

This configuration allows you to access the web server running inside the VM by opening the following URL in a browser on your host machine:

http://localhost:8080

The request sent to port 8080 on the host computer is transparently forwarded to port 80 of the virtual machine, where the Apache web server is listening.

Note: Port 80 is often already in use on the host system. Using port 8080 avoids conflicts while remaining a common convention for local web services.


Starting the server for installation

  • Once the settings have been specified, you can click on the Start icon (big fluo green array in VirtualBox).

  • A dialog box may appear “Please select a virtual optic disk …”. Click on the small folder icon and locate the disk image of Ubuntu that was downloaded in a previous step. Then click the Start button.

Ubuntu is now starting from the installation disk. The next section explains how to configure it.


Linux operating system installation

Ubuntu desktop version

The desktop version of Ubuntu presents the advantage of letting users work directly in the graphical environment of the Ubuntu virtual machine, which is convenient to open non-text result files for visualization (web pages, images) and to analyze the results in other graphical packages (R, openOffice, CytoScape, …).

  • Start the default installation: Click the button: Install Ubuntu
Install Ubuntu
Install Ubuntu
  • Keyboard layout: make your choice1

NOTE CLAVIER FRANÇAIS: for the French Macintosh keyboard, I spent a lot of time to find the solution to use the 3-component keys (e.g. alt-shit-L for the pipe character |). The simplest solution: use the alt key on the RIGHT side of the space bar.

  • Dialog box Preparing to install Ubuntu.

    • Make sure the option Download updates while installing Ubuntu is unchecked (we will update the packages after installation).
    • Leave the other parameters unchanged and click Continue.
Preparing to install Ubuntu
Preparing to install Ubuntu
  • Installation type:

    • Check Erase disk and install Ubuntu
    • Uncheck Encrypt new Ubuntu installation for security
    • Leave all other options unchanged.
    • Click Install Now.
    • There will be a warning message Write the changes to disk?. Click Continue.
Installation type
Installation type

In the dialog box Write the changes to disk? click Continue.

Write changes on disk
Write changes on disk
  • Where are you?

    If you VM has a suitable Internet connexion, your location should be detected automatically. If not, choose the right location.

Where are you?
Where are you?
  • Who are you?
Field Value
Your name RSAT admin
Your computer’s name rsat-vb-YYYY-MM
Pick a username rsat
Password tochng2
Log in automatically I activate it because this will greatly facilitate the use of the Destkop version
Click Continue
Who are you?
Who are you?

Ubuntu now installs the system, this should take a few minutes3.

Ubuntu installation
Ubuntu installation
  • After installation, Ubuntu displays a message “Installation is complete. You need to restart …”. Click Restart now.

  • When rebooting, Ubuntu warns you that you need to remove the installation medium and close the tray. In our case, the installation media is the iso disk. To remove it, go in the menu Devices -> Optical Drives -> Remove Disk from Optical Drive. If this does not work, close the window with the virtual machine, and restart this virtual machine from VirtualBox.

  • After reboot, you will automatically log in as RSAT admin user.

  • For the sake of convenience, I disactivate the lock screen and password prompt options. Indeed, since the VM is running under my account on the hosting system, there is no need to double the security options. For this, click on the Settings icon (toothed wheels) on the top-right corner of the Ubuntu display. Select All Settings and click on the panell Brightness and Lock. Set Lock to off and uncheck Require my password when waking from suspend.

Disactivate lock screen and password prompt after suspend.
Disactivate lock screen and password prompt after suspend.


Convenient settings (not necessary)

Clipboard sharing between guest and host

For the desktop version of Ubuntu, it is convenient to enable copy-paste between the guest and the host.

  • select the VM
  • In the VirtualBox menu, select Machine -> Settings
  • In panel “General”, select the tab Advanced, and set Shared clipboard to Bidirectional.
  • Optionnally, you can also set the Drag-n Drop option to Bidirectional.

Remote log in to the VM

So far the virtual machine does not support remote access. To add support for ssh access, we need to install the appropriate package.

  • In the virtual machine, open a terminal and type the following command.
## Install network and ssh tools
sudo apt-get install --quiet --assume-yes net-tools
sudo apt-get install --quiet --assume-yes ssh
sudo apt-get install --quiet --assume-yes openssh-server

## Test if the ssh is active
sudo systemctl status ssh

## If NOT active, you can activate it as follows
sudo systemctl enable ssh --now
sudo systemctl status ssh # check that is is active
  • From the host machine, open a terminal and type the following command.
ssh -p 2222 rsat@localhost

Notes:

  • The IP address above may be different on your computer, depending on the network settings of your VirtualBox and on the number of Virtual Machines currently running. If the address 192.168.56.101 does not work, you can obtain the IP address by typing ip -c a in a terminal on your virtual machine.

  • I personnally find it convenient to establish an ssh connection to the VM, in order to perform the subsequent installation steps from a terminal on my own operating system, but the next installation steps can as well be performed from the terminal in the Virtual Machine’s graphical environment.


Useful commands to manage VirtualBox

It is useful to install some VirtualBox accompanying software on your Ubuntu virtual machine.

sudo apt-get install --assume-yes --quiet virtualbox-guest-additions-iso 

Note: this package is no longer valid with the Apple M1/M2/M3 processors (ARM).

List running VMs

VBoxManage list runningvms

Get IDs of the virtual machines

VBoxManage list runningvms | awk -F"[{}]" '{print $2}'

For convenience, we store the IP of the machine of interest in an environment variable VMID.

VMID=`VBoxManage list runningvms | awk -F"[{}]" '{print $2}'`

Get properties of the VM

VBoxManage guestproperty enumerate ${VMID}

List information about a given virtual machine

VBoxManage showvminfo ${VMID}

Note: that command returns the MAC address, but no IP address.

VBoxManage showvminfo ${VMID} | grep '^NIC'

Create a generic user for the virtual machine

We create two separate users:

  • vmuser is a simple user of RSAT, has no right to administrate it (e.g. add new genomes, …)
  • rsat is the administrator for the Web site.

Both users (vmuser and rsat) have an initial password provided with the distribution (tochng), but which must be changed at the first login.

################################################################
## Create a user for the virtual machine
##
## This VM user is separate from the rsat user, which only serves to
## manage the RSAT software suite and related packages.
##
## For the sake of security, we force this user to change password at
## first login

## First delete this user (in case it was previously defined)
##  sudo userdel --remove vmuser

sudo useradd --password `openssl passwd -1 -salt xyz tochng`\
    --home /home/vmuser \
    --create-home \
    --shell /bin/bash \
    --comment "VM user" \
    vmuser

## Force vmuser to change password at first login
sudo chage -d 0 vmuser

## Force rsat user to change password at first login
sudo usermod --password `openssl passwd -1 -salt xyz tochng` rsat
sudo chage -d 0 rsat

## Add sudoer rights to vmuser and rsat users
sudo more /etc/sudoers
sudo chmod 644 /etc/sudoers
sudo nano /etc/sudoers
## Find the following line
##     # User privilege specification
##     root    ALL=(ALL:ALL) ALL
## Below it, add the following line:
##     rsat    ALL=(ALL:ALL) ALL
##     vmuser  ALL=(ALL:ALL) ALL
## Type "Ctrl-X" to exit from the nano editor, then "Y" to save your changes. 

Install Ubuntu packages and RSAT distribution

The instructions to install Ubuntu packages are found in the file INSTALL.md at the root of the RSAT folder.


PROBLEMS TO BE FIXED

  1. Ethernet: optimize solution for a simple setting in the classroom.

  2. Problem of disk occupancy: Ubuntu shared memory occupies 2Gb. This can be modified as explained here.

    http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html

  3. For the desktop version, I should try to use the Advanced installation in order to use less disk without loosing too much confort. For example, I could inactivate the support for all the languages that are installed by default (downloading language packs).


Customizing your instance of the VM

## Set up time zone, date and time (source:
## https://help.ubuntu.com/community/UbuntuTime).

For the Virtualbox VM: mount the virtual disk rsat_data

TO BE WRITTEN


Export appliance

Once the Virtual Machine is working fine, it can be exported to an appliance.

  • Shut down the Virtual Machine if it has not been done yet.

  • In VirtualBox, open “File -> Export Appliance …”, and select the VM.

    • Save as: rsat-vb-YYYY-MM.ova
    • Files of Type: Open Virtualization Format 1
    • Storage Settings
    • Format: OVF 1.0
      • Check this option: v Write Manifest File

Appliance Settings

Parameter Value
Name rsat-vb-YYYY-MM
Product Regulatory Sequences Analysis Tools
Product-URL http://rsat.eu/
Vendor Jacques van Helden
Vendor URL http://jacques.van-helden.perso.luminy.univ-amu.fr/
Version YYYY-MM
Description Regulatory Sequence Analysis Tools (RSAT, http://rsat.eu/), version YYYY-MM, installed on an Ubuntu 16.04 Virtual Machine.
License Free of use for academic users, non-commercial and non-military usage.


  1. I have a French - French Macintosh, so I use it for installation, but I will later add an English keybord for the distribution.↩︎

  2. This password is obviously not safe, but it will be changed at the end of the installation↩︎

  3. Note if you did activate the option to update Ubuntu packages in the previous window, the installation can take several minutes↩︎